<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/iconfont.css"/>
</head>
<body>
  <header class="aui-bar aui-bar-nav" id="aui-header">
      <a class="aui-btn aui-pull-left" tapmode onclick="closeWin()">
          <span class="aui-iconfont aui-icon-left"></span>
      </a>

      <a id="play" class="aui-btn aui-pull-right" tapmode onclick="jieXi()">
          换线
      </a>

  </header>
</body>
<script type="text/javascript" src="../script/api.js" ></script>
<script type="text/javascript">

    var jx_url1 = localStorage.getItem('jx_url1');
    var jx_url2 = localStorage.getItem('jx_url2');
    apiready = function(){

      api.parseTapmode();
      var header = $api.byId('aui-header');
      $api.fixStatusBar(header);
      var headerPos = $api.offset(header);
      var body_h = $api.offset($api.dom('body')).h;




      api.addEventListener({
          name: 'keyback'
      }, function(ret, err) {
        api.setScreenOrientation({
            orientation: 'portrait_up'
        });
        api.closeWin();
      });

      // var dialogBox = api.require('dialogBox');
      // dialogBox.discount({
      //     rect: {
      //         w: 300,
      //         h: 450
      //     },
      //     styles: {
      //         bg: '#FFF',
      //         image: {
      //             path: 'widget://image/bofang.png',
      //             marginB: 120
      //         },
      //         cancel: {
      //             icon: 'widget://image/cancel_btn.png',
      //             w: 40,
      //             h: 40
      //         }
      //     }
      // }, function(ret) {
      //     //alert(JSON.stringify(ret));
      //     if (ret.eventType == 'cancel') {
      //         dialogBox.close({
      //             dialogName: 'discount'
      //         });
      //     }
      // });


      var browser = api.require('webBrowser');
      browser.openView({
          url: api.pageParam.url,
          rect: {
              x: 0,
              y: 0,
              w: 'auto',
              h: 'auto'
          }
      }, function(ret, err) {
        // api.alert({
        //     msg: JSON.stringify(ret)
        // });
          switch (ret.state) {
              case 0:
                  break;
              case 1:
                  break;
              case 2:
              api.setScreenOrientation({
                  orientation: 'landscape_right'
              });
                  break;
              case 3:
                  break;
              case 4:
                  break;
              default:
                  break;
          };
          //dataurl = getCaption(dataurl);
          //alert(dataurl);
          // if (ret.state==2) {
          //   dataurl = ret.url;
          //   state = 2;
          // }
          // if (ret.state==3) {
          //   var title = $api.byId('title');
          //   title.innerHTML = '<i class="iconfont icon-svip"></i>'+ret.title;
          // }
          // if (ret.state==4) {
          //   dataurl = ret.url;
          //   state = 2;
          // }


      });


    }

    function getCaption(obj){
      var index=obj.lastIndexOf("\=");
      obj=obj.substring(index+1,obj.length);
      return obj;
    }

    function closeWin(){
      api.setScreenOrientation({
          orientation: 'portrait_up'
      });
      api.closeWin();
    }

    function jieXi(){
      api.actionSheet({
          title: '乐享视界VIP线路',
          cancelTitle: '取消',
          buttons: ['VIP线路1', 'VIP线路2', 'VIP线路3', 'VIP线路4', 'VIP线路5', 'VIP线路6', 'VIP线路7', 'VIP线路8', 'VIP线路9']
      }, function(ret, err) {
          var index = ret.buttonIndex;
          //alert( JSON.stringify( ret ) );
          if (ret.buttonIndex==1) {
            vipHuanxian('http://www.jiudingkeji.cn/odflv/index.php?url=');
          }
          if (ret.buttonIndex==2) {
            vipHuanxian('http://jiudingkeji.cn/kkflv/player.php?url=');
          }
          if (ret.buttonIndex==3) {
            vipHuanxian('http://qmyouku.duapp.com/bofang.php?url=');
          }
          if (ret.buttonIndex==4) {
            vipHuanxian('http://jx.jp-z.cn/vip/?url=');
          }
          if (ret.buttonIndex==5) {
            vipHuanxian('http://zhjiexi.cn/jx.php?url=');
          }
          if (ret.buttonIndex==6) {
            vipHuanxian('http://yun.mt2t.com/yun?url=');
          }
          if (ret.buttonIndex==7) {
            vipHuanxian('http://api74.19ah.cn/play/play1.php?url=');
          }
          if (ret.buttonIndex==8) {
            vipHuanxian('http://wapyo.cn/vip/jiexi.php?url=');
          }
          if (ret.buttonIndex==9) {
            vipHuanxian('http://jx.vgoodapi.com/jx.php?url=');
          }
      });
    }



    function vipHuanxian(jiekou){
      api.hideProgress();
      var browser = api.require('webBrowser');
      browser.loadUrl({
          url: jiekou+api.pageParam.url
      });
    }




</script>
</html>
